<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>rancher容器云管理平台 | 清峰小栈</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="rancher" />
  
  
  
  
  <meta name="description" content="Rancher容器云管理平台文中所有ip均为内网ip，外部互联网无法访问 一、主机硬件说明   序号 硬件 操作及内核    1 CPU 4 Memory 4G Disk 100G CentOS7   2 CPU 4 Memory 4G Disk 100G CentOS7   3 CPU 4 Memory 4G Disk 100G CentOS7   4 CPU 4 Memory 4G Disk">
<meta property="og:type" content="article">
<meta property="og:title" content="Rancher容器云管理平台">
<meta property="og:url" content="http://example.com/2022/11/17/Rancher/Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0/index.html">
<meta property="og:site_name" content="清峰小栈">
<meta property="og:description" content="Rancher容器云管理平台文中所有ip均为内网ip，外部互联网无法访问 一、主机硬件说明   序号 硬件 操作及内核    1 CPU 4 Memory 4G Disk 100G CentOS7   2 CPU 4 Memory 4G Disk 100G CentOS7   3 CPU 4 Memory 4G Disk 100G CentOS7   4 CPU 4 Memory 4G Disk">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111442.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111509.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111522.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111534.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111638.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111712.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111723.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111748.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111806.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111837.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111910.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111920.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111939.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112004.png">
<meta property="og:image" content="http://example.com/qingfeng-blog/Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0.assets/image-20220816153241393.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112054.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112103.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112113.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112119.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112129.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112139.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112146.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112202.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112210.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112218.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112242.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112257.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112319.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112401.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112431.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112441.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112503.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112514.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112523.png">
<meta property="og:image" content="http://example.com/qingfeng-blog/Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0.assets/image-20220816204323541.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112535.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112543.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112550.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112602.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112608.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112652.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112713.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112722.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112738.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112756.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112806.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112826.png">
<meta property="og:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112850.png">
<meta property="article:published_time" content="2022-11-17T01:35:44.000Z">
<meta property="article:modified_time" content="2023-05-06T03:32:06.395Z">
<meta property="article:author" content="清峰">
<meta property="article:tag" content="rancher">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111442.png">
  

  

  <link rel="icon" href="/qingfeng-blog/css/images/mylogo-2.png">
  <link rel="apple-touch-icon" href="/qingfeng-blog/css/images/mylogo-2.png">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <!-- <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> -->
  <link href="/qingfeng-blog/css/font-awesome.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt; src:url("/qingfeng-blog/css/fonts/FuturaPTBold.otf") format("woff");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt-light; src:url("/qingfeng-blog/css/fonts/FuturaPTBook.otf") format("woff");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt-italic; src:url("/qingfeng-blog/css/fonts/FuturaPTBookOblique.otf") format("woff");font-weight:400;font-style:italic;}
}

  </style>
  
<link rel="stylesheet" href="/qingfeng-blog/css/style.css">


  
<script src="/qingfeng-blog/js/jquery-3.1.1.min.js"></script>

  
<script src="/qingfeng-blog/js/bootstrap.js"></script>


  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/qingfeng-blog/css/bootstrap.css" >

  
    
<link rel="stylesheet" href="/qingfeng-blog/css/dialog.css">

  

  

  
    <link rel="stylesheet" href="/qingfeng-blog/css/header-post.css" >
  

  
  
  
    <link rel="stylesheet" href="/qingfeng-blog/css/vdonate.css" >
  

<meta name="generator" content="Hexo 6.3.0"></head>



  <body data-spy="scroll" data-target="#toc" data-offset="50">


  
  <div id="container">
    <div id="wrap">
      
        <header>

    <div id="allheader" class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="navbar-inner">
          
          <div class="container"> 
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>

            
              <a class="brand" style="
                 border-width: 0px;  margin-top: 0px;"  
                href="#" data-toggle="modal" data-target="#myModal" >
                  <img width="155px" height="90px" alt="Hike News" src="/qingfeng-blog/css/images/mylogo-2.png">
              </a>
            
            
            <div class="navbar-collapse collapse">
              <ul class="hnav navbar-nav">
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/">首页</a> </li>
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/categories">分类</a> </li>
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/tags">标签</a> </li>
                
                  <li><div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="Type something..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: 'Posts',
            PAGES: 'Pages',
            CATEGORIES: 'Categories',
            TAGS: 'Tags',
            UNTITLED: '(Untitled)',
        },
        ROOT_URL: '/qingfeng-blog/',
        CONTENT_URL: '/qingfeng-blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/qingfeng-blog/js/insight.js"></script>


</div></li>
            </div>
          </div>
                
      </div>
    </div>

</header>



      
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Rancher/Rancher容器云管理平台" style="width: 75%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
<div id="container">
  <div id="articleInner" class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      Rancher容器云管理平台
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	<a href="/qingfeng-blog/2022/11/17/Rancher/Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0/" class="article-date">
	  <time datetime="2022-11-17T01:35:44.000Z" itemprop="datePublished">2022-11-17</time>
	</a>

      
    <a class="article-category-link" href="/qingfeng-blog/categories/Rancher/">Rancher</a>

      
	<a class="article-views">
	<span id="busuanzi_container_page_pv">
		PV:<span id="busuanzi_value_page_pv"></span>
	</span>
	</a>

      

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="Rancher容器云管理平台"><a href="#Rancher容器云管理平台" class="headerlink" title="Rancher容器云管理平台"></a>Rancher容器云管理平台</h1><p><strong>文中所有ip均为内网ip，外部互联网无法访问</strong></p>
<h1 id="一、主机硬件说明"><a href="#一、主机硬件说明" class="headerlink" title="一、主机硬件说明"></a>一、主机硬件说明</h1><table>
<thead>
<tr>
<th>序号</th>
<th>硬件</th>
<th>操作及内核</th>
</tr>
</thead>
<tbody><tr>
<td>1</td>
<td>CPU 4 Memory 4G Disk 100G</td>
<td>CentOS7</td>
</tr>
<tr>
<td>2</td>
<td>CPU 4 Memory 4G Disk 100G</td>
<td>CentOS7</td>
</tr>
<tr>
<td>3</td>
<td>CPU 4 Memory 4G Disk 100G</td>
<td>CentOS7</td>
</tr>
<tr>
<td>4</td>
<td>CPU 4 Memory 4G Disk 100G</td>
<td>CentOS7</td>
</tr>
</tbody></table>
<h1 id="二、主机配置"><a href="#二、主机配置" class="headerlink" title="二、主机配置"></a>二、主机配置</h1><h2 id="2-1-主机名"><a href="#2-1-主机名" class="headerlink" title="2.1 主机名"></a>2.1 主机名</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># hostnamectl set-hostname rancherserver</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># hostnamectl set-hostname k8s-master01</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># hostnamectl set-hostname k8s-worker01</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># hostnamectl set-hostname k8s-worker02</span></span><br></pre></td></tr></table></figure>







<h2 id="2-2-IP地址"><a href="#2-2-IP地址" class="headerlink" title="2.2 IP地址"></a>2.2 IP地址</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">rancherserver</span> ~]<span class="comment"># vim /etc/sysconfig/network-scripts/ifcfg-ens33 </span></span><br><span class="line"><span class="comment"># cat /etc/sysconfig/network-scripts/ifcfg-ens33</span></span><br><span class="line"><span class="built_in">TYPE</span>=<span class="string">&quot;Ethernet&quot;</span></span><br><span class="line">PROXY_METHOD=<span class="string">&quot;none&quot;</span></span><br><span class="line">BROWSER_ONLY=<span class="string">&quot;no&quot;</span></span><br><span class="line">BOOTPROTO=<span class="string">&quot;none&quot;</span></span><br><span class="line">DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV4_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6INIT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_AUTOCONF=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6_ADDR_GEN_MODE=<span class="string">&quot;stable-privacy&quot;</span></span><br><span class="line">NAME=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">UUID=<span class="string">&quot;ec87533a-8151-4aa0-9d0f-1e970affcdc6&quot;</span></span><br><span class="line">DEVICE=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">ONBOOT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPADDR=<span class="string">&quot;192.168.10.130&quot;</span></span><br><span class="line">PREFIX=<span class="string">&quot;24&quot;</span></span><br><span class="line">GATEWAY=<span class="string">&quot;192.168.10.2&quot;</span></span><br><span class="line">DNS1=<span class="string">&quot;119.29.29.29&quot;</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># vim /etc/sysconfig/network-scripts/ifcfg-ens33 </span></span><br><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># cat /etc/sysconfig/network-scripts/ifcfg-ens33</span></span><br><span class="line"><span class="built_in">TYPE</span>=<span class="string">&quot;Ethernet&quot;</span></span><br><span class="line">PROXY_METHOD=<span class="string">&quot;none&quot;</span></span><br><span class="line">BROWSER_ONLY=<span class="string">&quot;no&quot;</span></span><br><span class="line">BOOTPROTO=<span class="string">&quot;none&quot;</span></span><br><span class="line">DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV4_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6INIT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_AUTOCONF=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6_ADDR_GEN_MODE=<span class="string">&quot;stable-privacy&quot;</span></span><br><span class="line">NAME=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">UUID=<span class="string">&quot;ec87533a-8151-4aa0-9d0f-1e970affcdc6&quot;</span></span><br><span class="line">DEVICE=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">ONBOOT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPADDR=<span class="string">&quot;192.168.10.131&quot;</span></span><br><span class="line">PREFIX=<span class="string">&quot;24&quot;</span></span><br><span class="line">GATEWAY=<span class="string">&quot;192.168.10.2&quot;</span></span><br><span class="line">DNS1=<span class="string">&quot;119.29.29.29&quot;</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">worker01</span> ~]<span class="comment"># vim /etc/sysconfig/network-scripts/ifcfg-ens33 </span></span><br><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">worker01</span> ~]<span class="comment"># cat /etc/sysconfig/network-scripts/ifcfg-ens33</span></span><br><span class="line"><span class="built_in">TYPE</span>=<span class="string">&quot;Ethernet&quot;</span></span><br><span class="line">PROXY_METHOD=<span class="string">&quot;none&quot;</span></span><br><span class="line">BROWSER_ONLY=<span class="string">&quot;no&quot;</span></span><br><span class="line">BOOTPROTO=<span class="string">&quot;none&quot;</span></span><br><span class="line">DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV4_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6INIT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_AUTOCONF=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6_ADDR_GEN_MODE=<span class="string">&quot;stable-privacy&quot;</span></span><br><span class="line">NAME=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">UUID=<span class="string">&quot;ec87533a-8151-4aa0-9d0f-1e970affcdc6&quot;</span></span><br><span class="line">DEVICE=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">ONBOOT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPADDR=<span class="string">&quot;192.168.10.132&quot;</span></span><br><span class="line">PREFIX=<span class="string">&quot;24&quot;</span></span><br><span class="line">GATEWAY=<span class="string">&quot;192.168.10.2&quot;</span></span><br><span class="line">DNS1=<span class="string">&quot;119.29.29.29&quot;</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">worker02</span> ~]<span class="comment"># vim /etc/sysconfig/network-scripts/ifcfg-ens33 </span></span><br><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">worker02</span> ~]<span class="comment"># cat /etc/sysconfig/network-scripts/ifcfg-ens33</span></span><br><span class="line"><span class="built_in">TYPE</span>=<span class="string">&quot;Ethernet&quot;</span></span><br><span class="line">PROXY_METHOD=<span class="string">&quot;none&quot;</span></span><br><span class="line">BROWSER_ONLY=<span class="string">&quot;no&quot;</span></span><br><span class="line">BOOTPROTO=<span class="string">&quot;none&quot;</span></span><br><span class="line">DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV4_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6INIT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_AUTOCONF=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_DEFROUTE=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPV6_FAILURE_FATAL=<span class="string">&quot;no&quot;</span></span><br><span class="line">IPV6_ADDR_GEN_MODE=<span class="string">&quot;stable-privacy&quot;</span></span><br><span class="line">NAME=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">UUID=<span class="string">&quot;ec87533a-8151-4aa0-9d0f-1e970affcdc6&quot;</span></span><br><span class="line">DEVICE=<span class="string">&quot;ens33&quot;</span></span><br><span class="line">ONBOOT=<span class="string">&quot;yes&quot;</span></span><br><span class="line">IPADDR=<span class="string">&quot;192.168.10.133&quot;</span></span><br><span class="line">PREFIX=<span class="string">&quot;24&quot;</span></span><br><span class="line">GATEWAY=<span class="string">&quot;192.168.10.2&quot;</span></span><br><span class="line">DNS1=<span class="string">&quot;119.29.29.29&quot;</span></span><br></pre></td></tr></table></figure>





<h2 id="2-3-主机名与IP地址解析"><a href="#2-3-主机名与IP地址解析" class="headerlink" title="2.3 主机名与IP地址解析"></a>2.3 主机名与IP地址解析</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># cat /etc/hosts</span></span><br><span class="line"><span class="number">127.0</span>.<span class="number">0.1</span>   localhost localhost.localdomain localhost4 localhost4.localdomain4</span><br><span class="line">::<span class="number">1</span>         localhost localhost.localdomain localhost6 localhost6.localdomain6</span><br><span class="line"><span class="number">192.168</span>.<span class="number">10.130</span> rancherserver</span><br><span class="line"><span class="number">192.168</span>.<span class="number">10.131</span> k8s<span class="literal">-master01</span></span><br><span class="line"><span class="number">192.168</span>.<span class="number">10.132</span> k8s<span class="literal">-worker01</span></span><br><span class="line"><span class="number">192.168</span>.<span class="number">10.133</span> k8s<span class="literal">-worker02</span></span><br></pre></td></tr></table></figure>





<h2 id="2-4-主机安全设置"><a href="#2-4-主机安全设置" class="headerlink" title="2.4 主机安全设置"></a>2.4 主机安全设置</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># systemctl stop firewalld;systemctl disable firewalld</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># firewall-cmd --state</span></span><br><span class="line">not running</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># sed -ri &#x27;s/SELINUX=enforcing/SELINUX=disabled/&#x27; /etc/selinux/config</span></span><br></pre></td></tr></table></figure>





<h2 id="2-5-主机时钟同步"><a href="#2-5-主机时钟同步" class="headerlink" title="2.5 主机时钟同步"></a>2.5 主机时钟同步</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># crontab -l</span></span><br><span class="line"><span class="number">0</span> */<span class="number">1</span> * * * ntpdate time1.aliyun.com</span><br></pre></td></tr></table></figure>



<h2 id="2-6-关闭swap"><a href="#2-6-关闭swap" class="headerlink" title="2.6 关闭swap"></a>2.6 关闭swap</h2><blockquote>
<p>关闭k8s集群节点swap</p>
</blockquote>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># cat /etc/fstab</span></span><br><span class="line"></span><br><span class="line">默认开启，修改后关闭</span><br><span class="line"><span class="comment">#/dev/mapper/centos-swap swap                    swap    defaults        0 0</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">临时关闭所有</span><br><span class="line"><span class="comment"># swapoff -a</span></span><br></pre></td></tr></table></figure>



<h2 id="2-7-配置内核路由转发"><a href="#2-7-配置内核路由转发" class="headerlink" title="2.7 配置内核路由转发"></a>2.7 配置内核路由转发</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># vim /etc/sysctl.conf</span></span><br><span class="line"><span class="comment"># cat /etc/sysctl.conf</span></span><br><span class="line">...</span><br><span class="line">net.ipv4.ip_forward=<span class="number">1</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># sysctl -p</span></span><br><span class="line">net.ipv4.ip_forward = <span class="number">1</span></span><br></pre></td></tr></table></figure>



<h1 id="三、docker-ce安装"><a href="#三、docker-ce安装" class="headerlink" title="三、docker-ce安装"></a>三、docker-ce安装</h1><blockquote>
<p>所有主机安装docker-ce</p>
</blockquote>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># yum -y install docker-ce</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># systemctl enable --now docker</span></span><br></pre></td></tr></table></figure>



<h1 id="四、rancher安装"><a href="#四、rancher安装" class="headerlink" title="四、rancher安装"></a>四、rancher安装</h1><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111442.png" alt="image-20220816144830488"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111509.png" alt="image-20220816144953656"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">rancherserver</span> ~]<span class="comment"># docker pull rancher/rancher:v2.5.15</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">rancherserver</span> ~]<span class="comment"># mkdir -p /opt/data/rancher_data</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">rancherserver</span> ~]<span class="comment"># docker run -d --privileged -p 80:80 -p 443:443 -v /opt/data/rancher_data:/var/lib/rancher --restart=always --name rancher-2.5.15 rancher/rancher:v2.5.15</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">rancherserver</span> ~]<span class="comment"># docker ps</span></span><br><span class="line">CONTAINER ID   IMAGE                     COMMAND           CREATED          STATUS          PORTS                                                                      NAMES</span><br><span class="line"><span class="number">99</span>e367eb35a3   rancher/rancher:v2.<span class="number">5.15</span>   <span class="string">&quot;entrypoint.sh&quot;</span>   <span class="number">26</span> seconds ago   Up <span class="number">26</span> seconds   <span class="number">0.0</span>.<span class="number">0.0</span>:<span class="number">80</span>-&gt;<span class="number">80</span>/tcp, :::<span class="number">80</span>-&gt;<span class="number">80</span>/tcp, <span class="number">0.0</span>.<span class="number">0.0</span>:<span class="number">443</span>-&gt;<span class="number">443</span>/tcp, :::<span class="number">443</span>-&gt;<span class="number">443</span>/tcp   rancher<span class="literal">-2</span>.<span class="number">5.15</span></span><br></pre></td></tr></table></figure>



<h1 id="五、通过Rancher部署kubernetes集群"><a href="#五、通过Rancher部署kubernetes集群" class="headerlink" title="五、通过Rancher部署kubernetes集群"></a>五、通过Rancher部署kubernetes集群</h1><h2 id="5-1-Rancher访问"><a href="#5-1-Rancher访问" class="headerlink" title="5.1 Rancher访问"></a>5.1 Rancher访问</h2><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111522.png" alt="image-20220816150151634"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111534.png" alt="image-20220816150209913"></p>
<blockquote>
<p>本次密码为Kubemsb123</p>
</blockquote>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111638.png" alt="image-20220816150450409"></p>
<h2 id="5-2-通过Rancher创建Kubernetes集群"><a href="#5-2-通过Rancher创建Kubernetes集群" class="headerlink" title="5.2 通过Rancher创建Kubernetes集群"></a>5.2 通过Rancher创建Kubernetes集群</h2><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111712.png" alt="image-20220816150706088"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111723.png" alt="image-20220816150736103"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111748.png" alt="image-20220816151001001"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111806.png" alt="image-20220816151039880"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111837.png" alt="image-20220816151157176"></p>
<p>添加master节点主机</p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111910.png" alt="image-20220816151352377"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run  rancher/rancher-agent:v2.5.15 --server https://192.168.10.130 --token 7985nkpc48854kwmgh6pnfb7hcrkwhlcmx6wxq8tb4vszxn2qv9xdd --ca-checksum f6d5f24fcd41aa057a205d4f6922dfd309001126d040431222bfba7aa93517b7 --etcd --controlplane --worker</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># docker ps</span></span><br><span class="line">CONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS          PORTS     NAMES</span><br><span class="line"><span class="number">8</span>e7e73b477dc   rancher/rancher<span class="literal">-agent</span>:v2.<span class="number">5.15</span>   <span class="string">&quot;run.sh --server htt…&quot;</span>   <span class="number">20</span> seconds ago   Up <span class="number">18</span> seconds             brave_ishizaka</span><br></pre></td></tr></table></figure>







<p>添加 worker节点</p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111920.png" alt="image-20220816151709536"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506111939.png" alt="image-20220816151746413"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">worker01</span> ~]<span class="comment"># docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run  rancher/rancher-agent:v2.5.15 --server https://192.168.10.130 --token 7985nkpc48854kwmgh6pnfb7hcrkwhlcmx6wxq8tb4vszxn2qv9xdd --ca-checksum f6d5f24fcd41aa057a205d4f6922dfd309001126d040431222bfba7aa93517b7 --worker</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">worker02</span> ~]<span class="comment"># docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run  rancher/rancher-agent:v2.5.15 --server https://192.168.10.130 --token 7985nkpc48854kwmgh6pnfb7hcrkwhlcmx6wxq8tb4vszxn2qv9xdd --ca-checksum f6d5f24fcd41aa057a205d4f6922dfd309001126d040431222bfba7aa93517b7 --worker</span></span><br></pre></td></tr></table></figure>

<p>所有节点激活后状态</p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112004.png" alt="image-20220816152917840"></p>
<h1 id="六、配置通过命令行访问Kubernetes集群"><a href="#六、配置通过命令行访问Kubernetes集群" class="headerlink" title="六、配置通过命令行访问Kubernetes集群"></a>六、配置通过命令行访问Kubernetes集群</h1><p><img src="/qingfeng-blog/Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0.assets/image-20220816153241393.png" alt="image-20220816153241393"></p>
<p>在集群节点命令行，如果访问呢？</p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112054.png" alt="image-20220816153917499"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112103.png" alt="image-20220816154006380"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># cat &lt;&lt;EOF &gt; /etc/yum.repos.d/kubernetes.repo</span></span><br><span class="line">[<span class="type">kubernetes</span>]</span><br><span class="line">name=Kubernetes</span><br><span class="line">baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes<span class="literal">-el7-x86_64</span>/</span><br><span class="line">enabled=<span class="number">1</span></span><br><span class="line">gpgcheck=<span class="number">1</span></span><br><span class="line">repo_gpgcheck=<span class="number">1</span></span><br><span class="line">gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum<span class="literal">-key</span>.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm<span class="literal">-package-key</span>.gpg</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>



<p>修改gpgcheck&#x3D;0及修改repo_gpgcheck&#x3D;0</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># vim /etc/yum.repos.d/kubernetes.repo</span></span><br><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># cat  /etc/yum.repos.d/kubernetes.repo</span></span><br><span class="line">[<span class="type">kubernetes</span>]</span><br><span class="line">name=Kubernetes</span><br><span class="line">baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes<span class="literal">-el7-x86_64</span>/</span><br><span class="line">enabled=<span class="number">1</span></span><br><span class="line">gpgcheck=<span class="number">0</span></span><br><span class="line">repo_gpgcheck=<span class="number">0</span></span><br><span class="line">gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum<span class="literal">-key</span>.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm<span class="literal">-package-key</span>.gpg</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># yum -y install kubectl</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># mkdir ~/.kube</span></span><br></pre></td></tr></table></figure>



<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112113.png" alt="image-20220816155110578"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112119.png" alt="image-20220816155140075"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># vim ~/.kube/config</span></span><br><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># cat ~/.kube/config</span></span><br><span class="line">apiVersion: v1</span><br><span class="line">kind: Config</span><br><span class="line">clusters:</span><br><span class="line">- name: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br><span class="line">  cluster:</span><br><span class="line">    server: <span class="string">&quot;https://192.168.10.130/k8s/clusters/c-5jtsf&quot;</span></span><br><span class="line">    certificate<span class="literal">-authority-data</span>: <span class="string">&quot;LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJwekNDQ\</span></span><br><span class="line"><span class="string">      VUyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQTdNUnd3R2dZRFZRUUtFeE5rZVc1aGJXbGoKY\</span></span><br><span class="line"><span class="string">      kdsemRHVnVaWEl0YjNKbk1Sc3dHUVlEVlFRREV4SmtlVzVoYldsamJHbHpkR1Z1WlhJdFkyRXdIa\</span></span><br><span class="line"><span class="string">      GNOTWpJdwpPREUyTURZMU9UVTBXaGNOTXpJd09ERXpNRFkxT1RVMFdqQTdNUnd3R2dZRFZRUUtFe\</span></span><br><span class="line"><span class="string">      E5rZVc1aGJXbGpiR2x6CmRHVnVaWEl0YjNKbk1Sc3dHUVlEVlFRREV4SmtlVzVoYldsamJHbHpkR\</span></span><br><span class="line"><span class="string">      1Z1WlhJdFkyRXdXVEFUQmdjcWhrak8KUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVJMbDZKOWcxMlJQT\</span></span><br><span class="line"><span class="string">      G93dnVHZkM0YnR3ZmhHUDBpR295N1U2cjBJK0JZeAozZCtuVDBEc3ZWOVJWV1BDOGZCdGhPZmJQN\</span></span><br><span class="line"><span class="string">      GNYckx5YzJsR081RHkrSXRlM28wSXdRREFPQmdOVkhROEJBZjhFCkJBTUNBcVF3RHdZRFZSMFRBU\</span></span><br><span class="line"><span class="string">      UgvQkFVd0F3RUIvekFkQmdOVkhRNEVGZ1FVNnZYWXBRYm9IdXF0UlBuS1FrS3gKMjBSZzJqMHdDZ\</span></span><br><span class="line"><span class="string">      1lJS29aSXpqMEVBd0lEU0FBd1JRSWdMTUJ6YXNDREU4T2tCUk40TWRuZWNRU0xjMFVXQmNseApGO\</span></span><br><span class="line"><span class="string">      UFCem1MQWQwb0NJUUNlRWFnRkdBa1ZsUnV1czllSE1VRUx6ODl6VlY5L096b3hvY1ROYnA5amlBP\</span></span><br><span class="line"><span class="string">      T0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQ==&quot;</span></span><br><span class="line">- name: <span class="string">&quot;kubemsb-smart-1-k8s-master01&quot;</span></span><br><span class="line">  cluster:</span><br><span class="line">    server: <span class="string">&quot;https://192.168.10.131:6443&quot;</span></span><br><span class="line">    certificate<span class="literal">-authority-data</span>: <span class="string">&quot;LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM0VENDQ\</span></span><br><span class="line"><span class="string">      WNtZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFTTVJBd0RnWURWUVFERXdkcmRXSmwKT\</span></span><br><span class="line"><span class="string">      FdOaE1CNFhEVEl5TURneE5qQTNNVFV3TmxvWERUTXlNRGd4TXpBM01UVXdObG93RWpFUU1BNEdBM\</span></span><br><span class="line"><span class="string">      VVFQXhNSAphM1ZpWlMxallUQ0NBU0l3RFFZSktvWklodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ\</span></span><br><span class="line"><span class="string">      0VCQUt4Qkh3S0RFZE5WCm1tU2JFZDZXaTZzRFNXcklPZEZ5dFN5Z1puVmk2cXFkYmxXODZRQ1Y1U\</span></span><br><span class="line"><span class="string">      WdEckI5QU43aDJ1RHRZMlFiNGZOTmEKQWZkSVVhS2tjZ0taNnplS1Z3eEdRYkptcEovSk5yYWw2N\</span></span><br><span class="line"><span class="string">      ENldng5QTU1UUFBL29FSzBVbkdackliSjQ5dEl4awp1TnMwNFVIRWxVVUZpWjlmckdBQU9sK3lVa\</span></span><br><span class="line"><span class="string">      GxXQUlLQzhmMUZSeVhpaVZEN2FTcTVodHNWeC9qczBBUUo3R2dFCjMxQUdRcmF4S2s0STVCN1hBY\</span></span><br><span class="line"><span class="string">      1pybHdrS1ljaGFPZnBlNkV6Ly9HZXVFekR5VnN3a09uK2h0ZGNIMlJVSHozUlcKWWVTMGw2ZzZpO\</span></span><br><span class="line"><span class="string">      HcyUXRUakNwTUtId1FRTmQwSjdFM0k1aS9CRVA0azhXSHZIYjBkQk8ydVkyTml1cmNMWWw4dgpHO\</span></span><br><span class="line"><span class="string">      DUyZ2ZibWt2OENBd0VBQWFOQ01FQXdEZ1lEVlIwUEFRSC9CQVFEQWdLa01BOEdBMVVkRXdFQi93U\</span></span><br><span class="line"><span class="string">      UZNQU1CCkFmOHdIUVlEVlIwT0JCWUVGQkg4VzVBbmxKYVNrVXowSzNobms1Vm55MVNnTUEwR0NTc\</span></span><br><span class="line"><span class="string">      UdTSWIzRFFFQkN3VUEKQTRJQkFRQmE0WmtsWmRINUFCOTNWaXhYOUhnMEYwYXdVZWduNkVSRGtRQ\</span></span><br><span class="line"><span class="string">      VBlcHZNaG5ON1lyVGlFN3lUSGxvWApLNS9ROTJ5Y2FnRGVlNjlEbHpvWEppTlNzdEZWYmtaSVN0O\</span></span><br><span class="line"><span class="string">      HVRZFhCYjFoSUtzbXBVYWlSeXFoRmVjbnRaSi85CmhCWmZMRjZnNitBNUlvVGxYOThqMERVU21IV\</span></span><br><span class="line"><span class="string">      is2Q29raXhPV3ZESmJ6dkI2S3VXdnhQbTF5WFgveVpBTDd1U1gKcUNnTC84UjJjSm53dUZhTnFvS\</span></span><br><span class="line"><span class="string">      3I3STE5bDBRNi9VWWQ0bWhralpmUTdqdGlraEpmQXpWRUFtWlVza0hZSkRtdwp6bzJKMUJLL0Jxb\</span></span><br><span class="line"><span class="string">      m8rSFplbThFTExpK1ZhRXVlR280blF4ZmpaSlF2MWFXZHhCMnRrUWovdWNUa1QxRU1kUFBsCm0rd\</span></span><br><span class="line"><span class="string">      kh2MWtYNW5BaHl5eWR0dG12UGRlOWFHOUwKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=&quot;</span></span><br><span class="line"></span><br><span class="line">users:</span><br><span class="line">- name: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br><span class="line">  user:</span><br><span class="line">    token: <span class="string">&quot;kubeconfig-user-9cn9x.c-5jtsf:x57644qvmbfqpmh78fb4cbdnm8zbbxk9hmjb2bjggl5j2hvwnvj4c9&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">contexts:</span><br><span class="line">- name: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br><span class="line">  context:</span><br><span class="line">    user: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br><span class="line">    cluster: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br><span class="line">- name: <span class="string">&quot;kubemsb-smart-1-k8s-master01&quot;</span></span><br><span class="line">  context:</span><br><span class="line">    user: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br><span class="line">    cluster: <span class="string">&quot;kubemsb-smart-1-k8s-master01&quot;</span></span><br><span class="line"></span><br><span class="line">current<span class="literal">-context</span>: <span class="string">&quot;kubemsb-smart-1&quot;</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># kubectl get nodes</span></span><br><span class="line">NAME           STATUS   ROLES                      AGE   VERSION</span><br><span class="line">k8s<span class="literal">-master01</span>   Ready    controlplane,etcd,worker   <span class="number">35</span>m   v1.<span class="number">20.15</span></span><br><span class="line">k8s<span class="literal">-worker01</span>   Ready    worker                     <span class="number">31</span>m   v1.<span class="number">20.15</span></span><br><span class="line">k8s<span class="literal">-worker02</span>   Ready    worker                     <span class="number">27</span>m   v1.<span class="number">20.15</span></span><br></pre></td></tr></table></figure>



<h1 id="七、通过Rancher部署Nginx应用"><a href="#七、通过Rancher部署Nginx应用" class="headerlink" title="七、通过Rancher部署Nginx应用"></a>七、通过Rancher部署Nginx应用</h1><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112129.png" alt="image-20220816155537732"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112139.png" alt="image-20220816155741848"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112146.png" alt="image-20220816155932470"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112202.png" alt="image-20220816160056177"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112210.png" alt="image-20220816160200746"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112218.png" alt="image-20220816160254842"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112242.png" alt="image-20220816160733605"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># kubectl get svc -n kubemsbf-1</span></span><br><span class="line">NAME               <span class="built_in">TYPE</span>        CLUSTER<span class="literal">-IP</span>      EXTERNAL<span class="literal">-IP</span>   PORT(S)        AGE</span><br><span class="line">myapp<span class="literal">-1</span>            ClusterIP   <span class="number">10.43</span>.<span class="number">15.240</span>    &lt;none&gt;        <span class="number">80</span>/TCP         <span class="number">4</span>m35s</span><br><span class="line">myapp<span class="literal">-1-nodeport</span>   NodePort    <span class="number">10.43</span>.<span class="number">214.118</span>   &lt;none&gt;        <span class="number">80</span>:<span class="number">32406</span>/TCP   <span class="number">4</span>m35s</span><br></pre></td></tr></table></figure>

<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112257.png" alt="image-20220816162243693"></p>
<h1 id="八、通过Rancher部署mysql数据库"><a href="#八、通过Rancher部署mysql数据库" class="headerlink" title="八、通过Rancher部署mysql数据库"></a>八、通过Rancher部署mysql数据库</h1><h2 id="8-1-持久化存储类准备"><a href="#8-1-持久化存储类准备" class="headerlink" title="8.1 持久化存储类准备"></a>8.1 持久化存储类准备</h2><h3 id="8-1-1-NFS服务"><a href="#8-1-1-NFS服务" class="headerlink" title="8.1.1 NFS服务"></a>8.1.1 NFS服务</h3><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># lsblk</span></span><br><span class="line">NAME            MAJ:MIN <span class="built_in">RM</span>  SIZE RO <span class="built_in">TYPE</span> MOUNTPOINT</span><br><span class="line">sda               <span class="number">8</span>:<span class="number">0</span>    <span class="number">0</span>  <span class="number">100</span>G  <span class="number">0</span> disk</span><br><span class="line">├─sda1            <span class="number">8</span>:<span class="number">1</span>    <span class="number">0</span>    <span class="number">1</span>G  <span class="number">0</span> part /boot</span><br><span class="line">└─sda2            <span class="number">8</span>:<span class="number">2</span>    <span class="number">0</span>   <span class="number">99</span>G  <span class="number">0</span> part</span><br><span class="line">  ├─centos<span class="literal">-root</span> <span class="number">253</span>:<span class="number">0</span>    <span class="number">0</span>   <span class="number">50</span>G  <span class="number">0</span> lvm  /</span><br><span class="line">  ├─centos<span class="literal">-swap</span> <span class="number">253</span>:<span class="number">1</span>    <span class="number">0</span>    <span class="number">2</span>G  <span class="number">0</span> lvm</span><br><span class="line">  └─centos<span class="literal">-home</span> <span class="number">253</span>:<span class="number">2</span>    <span class="number">0</span>   <span class="number">47</span>G  <span class="number">0</span> lvm  /home</span><br><span class="line">sdb               <span class="number">8</span>:<span class="number">16</span>   <span class="number">0</span>  <span class="number">100</span>G  <span class="number">0</span> disk /sdb</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># mkdir /sdb</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># mkfs.xfs /dev/sdb</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment">#vim /etc/fstab</span></span><br><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># cat /etc/fstab</span></span><br><span class="line">......</span><br><span class="line">/dev/sdb                /sdb                    xfs     defaults        <span class="number">0</span> <span class="number">0</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># mount -a</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># vim /etc/exports</span></span><br><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># cat /etc/exports</span></span><br><span class="line">/sdb    *(rw,sync,no_root_squash)</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># systemctl enable --now nfs-server</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># showmount -e</span></span><br><span class="line">Export list <span class="keyword">for</span> nfs<span class="literal">-server</span>:</span><br><span class="line">/sdb *</span><br></pre></td></tr></table></figure>



<h3 id="8-1-2-存储卷"><a href="#8-1-2-存储卷" class="headerlink" title="8.1.2 存储卷"></a>8.1.2 存储卷</h3><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span>  ~]<span class="comment"># for file in class.yaml deployment.yaml rbac.yaml  ; do wget https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/$file ; done</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p>需要修改class.yaml中资源对象名称为nfs-client</p>
<p>需要修改deployment.yaml中nfs server及其共享的目录、容器对应的镜像。</p>
</blockquote>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span>  ~]<span class="comment"># kubectl apply -f class.yaml</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span>  ~]<span class="comment"># kubectl apply -f rbac.yaml</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> <span class="type">nfsdir</span>]<span class="comment"># vim deployment.yaml</span></span><br><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> <span class="type">nfsdir</span>]<span class="comment"># cat deployment.yaml</span></span><br><span class="line">apiVersion: apps/v1</span><br><span class="line">kind: Deployment</span><br><span class="line">metadata:</span><br><span class="line">  name: nfs<span class="literal">-client-provisioner</span></span><br><span class="line">  labels:</span><br><span class="line">    app: nfs<span class="literal">-client-provisioner</span></span><br><span class="line">  <span class="comment"># replace with namespace where provisioner is deployed</span></span><br><span class="line">  namespace: default</span><br><span class="line">spec:</span><br><span class="line">  replicas: <span class="number">1</span></span><br><span class="line">  strategy:</span><br><span class="line">    <span class="built_in">type</span>: Recreate</span><br><span class="line">  selector:</span><br><span class="line">    matchLabels:</span><br><span class="line">      app: nfs<span class="literal">-client-provisioner</span></span><br><span class="line">  template:</span><br><span class="line">    metadata:</span><br><span class="line">      labels:</span><br><span class="line">        app: nfs<span class="literal">-client-provisioner</span></span><br><span class="line">    spec:</span><br><span class="line">      serviceAccountName: nfs<span class="literal">-client-provisioner</span></span><br><span class="line">      containers:</span><br><span class="line">        - name: nfs<span class="literal">-client-provisioner</span></span><br><span class="line">          image: registry.cn<span class="literal">-beijing</span>.aliyuncs.com/pylixm/nfs<span class="literal">-subdir-external-provisioner</span>:v4.<span class="number">0.0</span></span><br><span class="line">          volumeMounts:</span><br><span class="line">            - name: nfs<span class="literal">-client-root</span></span><br><span class="line">              mountPath: /persistentvolumes</span><br><span class="line">          env:</span><br><span class="line">            - name: PROVISIONER_NAME</span><br><span class="line">              value: fuseim.pri/ifs</span><br><span class="line">            - name: NFS_SERVER</span><br><span class="line">              value: <span class="number">192.168</span>.<span class="number">10.133</span></span><br><span class="line">            - name: NFS_PATH</span><br><span class="line">              value: /sdb</span><br><span class="line">      volumes:</span><br><span class="line">        - name: nfs<span class="literal">-client-root</span></span><br><span class="line">          nfs:</span><br><span class="line">            server: <span class="number">192.168</span>.<span class="number">10.133</span></span><br><span class="line">            path: /sdb</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span>  ~]<span class="comment"># kubectl apply -f deployment.yaml</span></span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span>  ~]<span class="comment"># kubectl get sc</span></span><br><span class="line">NAME         PROVISIONER      RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE</span><br><span class="line">nfs<span class="literal">-client</span>   fuseim.pri/ifs   Delete          Immediate           false                  <span class="number">109</span>m</span><br></pre></td></tr></table></figure>

<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112319.png" alt="image-20220816185710948"></p>
<h2 id="8-2-MySQL数据库部署"><a href="#8-2-MySQL数据库部署" class="headerlink" title="8.2 MySQL数据库部署"></a>8.2 MySQL数据库部署</h2><h3 id="8-2-1-PVC准备"><a href="#8-2-1-PVC准备" class="headerlink" title="8.2.1 PVC准备"></a>8.2.1 PVC准备</h3><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112401.png" alt="image-20220816202814643"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112431.png" alt="image-20220816202953810"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112441.png" alt="image-20220816203153592"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># kubectl get pvc -n kubemsbdata</span></span><br><span class="line">NAME       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE</span><br><span class="line">myvolume   Bound    pvc<span class="literal">-52460d7f-db89-40ab-b09e-ab9d0cfcaa17</span>   <span class="number">5</span><span class="built_in">Gi</span>        RWO            nfs<span class="literal">-client</span>     <span class="number">80</span>s</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># kubectl get pv</span></span><br><span class="line">NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                  STORAGECLASS   REASON   AGE</span><br><span class="line">pvc<span class="literal">-52460d7f-db89-40ab-b09e-ab9d0cfcaa17</span>   <span class="number">5</span><span class="built_in">Gi</span>        RWO            Delete           Bound    kubemsbdata/myvolume   nfs<span class="literal">-client</span>              <span class="number">84</span>s</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">nfsserver</span> ~]<span class="comment"># ls /sdb</span></span><br><span class="line">kubemsbdata<span class="literal">-myvolume-pvc-52460d7f-db89-40ab-b09e-ab9d0cfcaa17</span></span><br></pre></td></tr></table></figure>





<h3 id="8-2-2-MySQL部署"><a href="#8-2-2-MySQL部署" class="headerlink" title="8.2.2 MySQL部署"></a>8.2.2 MySQL部署</h3><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112503.png" alt="image-20220816205034201"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112514.png" alt="image-20220816204138975"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112523.png" alt="image-20220816204242066"></p>
<p><img src="/qingfeng-blog/Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0.assets/image-20220816204323541.png" alt="image-20220816204323541"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112535.png" alt="image-20220816204356332"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112543.png" alt="image-20220816204448683"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112550.png" alt="image-20220816205248456"></p>
<h3 id="8-2-2-MySQL访问"><a href="#8-2-2-MySQL访问" class="headerlink" title="8.2.2 MySQL访问"></a>8.2.2 MySQL访问</h3><h4 id="8-2-2-1-方案一-通过Rancher-web界面访问"><a href="#8-2-2-1-方案一-通过Rancher-web界面访问" class="headerlink" title="8.2.2.1 方案一 通过Rancher web界面访问"></a>8.2.2.1 方案一 通过Rancher web界面访问</h4><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112602.png" alt="image-20220816201739371"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112608.png" alt="image-20220816201826018"></p>
<h4 id="8-2-2-2-方案二-通过主机访问"><a href="#8-2-2-2-方案二-通过主机访问" class="headerlink" title="8.2.2.2 方案二 通过主机访问"></a>8.2.2.2 方案二 通过主机访问</h4><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># ss -anput | grep &quot;:32666&quot;</span></span><br><span class="line">tcp    LISTEN     <span class="number">0</span>      <span class="number">128</span>       *:<span class="number">32666</span>                 *:*                   users:((<span class="string">&quot;kube-proxy&quot;</span>,pid=<span class="number">7654</span>,fd=<span class="number">3</span>))</span><br></pre></td></tr></table></figure>



<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> <span class="type">nfsdir</span>]<span class="comment"># mysql -h 192.168.10.131 -uroot -p123456 -P 32666</span></span><br><span class="line">......</span><br><span class="line">MySQL [(<span class="type">none</span>)]&gt; show databases;</span><br><span class="line">+<span class="literal">--------------------</span>+</span><br><span class="line">| Database           |</span><br><span class="line">+<span class="literal">--------------------</span>+</span><br><span class="line">| information_schema |</span><br><span class="line">| kubemsb            |</span><br><span class="line">| mysql              |</span><br><span class="line">| performance_schema |</span><br><span class="line">| sys                |</span><br><span class="line">+<span class="literal">--------------------</span>+</span><br><span class="line"><span class="number">5</span> rows <span class="keyword">in</span> <span class="built_in">set</span> (<span class="number">0.01</span> sec)</span><br></pre></td></tr></table></figure>





<h1 id="九、部署wordpress"><a href="#九、部署wordpress" class="headerlink" title="九、部署wordpress"></a>九、部署wordpress</h1><p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112652.png" alt="image-20220816210220210"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112713.png" alt="image-20220816210440574"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112722.png" alt="image-20220816211312775"></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">root</span>@<span class="type">k8s</span>-<span class="type">master01</span> ~]<span class="comment"># dig -t a mysqldata1-0.mysqldata1.kubemsbdata.svc.cluster.local @10.43.0.10</span></span><br><span class="line"></span><br><span class="line">; &lt;&lt;&gt;&gt; DiG <span class="number">9.11</span>.<span class="number">4</span><span class="literal">-P2-RedHat-9</span>.<span class="number">11.4</span><span class="literal">-26</span>.P2.el7_9.<span class="number">8</span> &lt;&lt;&gt;&gt; <span class="literal">-t</span> a mysqldata1<span class="literal">-0</span>.mysqldata1.kubemsbdata.svc.cluster.local @<span class="number">10.43</span>.<span class="number">0.10</span></span><br><span class="line">;; global options: +cmd</span><br><span class="line">;; Got answer:</span><br><span class="line">;; WARNING: .local is reserved <span class="keyword">for</span> Multicast DNS</span><br><span class="line">;; You are currently testing what happens when an mDNS query is leaked to DNS</span><br><span class="line">;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: <span class="number">63314</span></span><br><span class="line">;; flags: qr aa <span class="built_in">rd</span>; QUERY: <span class="number">1</span>, ANSWER: <span class="number">1</span>, AUTHORITY: <span class="number">0</span>, ADDITIONAL: <span class="number">1</span></span><br><span class="line">;; WARNING: recursion requested but not available</span><br><span class="line"></span><br><span class="line">;; OPT PSEUDOSECTION:</span><br><span class="line">; EDNS: version: <span class="number">0</span>, flags:; udp: <span class="number">4096</span></span><br><span class="line">;; QUESTION SECTION:</span><br><span class="line">;mysqldata1<span class="literal">-0</span>.mysqldata1.kubemsbdata.svc.cluster.local. <span class="keyword">IN</span> A</span><br><span class="line"></span><br><span class="line">;; ANSWER SECTION:</span><br><span class="line">mysqldata1<span class="literal">-0</span>.mysqldata1.kubemsbdata.svc.cluster.local. <span class="number">5</span> <span class="keyword">IN</span> A <span class="number">10.42</span>.<span class="number">1.4</span></span><br><span class="line"></span><br><span class="line">;; Query time: <span class="number">0</span> msec</span><br><span class="line">;; SERVER: <span class="number">10.43</span>.<span class="number">0.10</span><span class="comment">#53(10.43.0.10)</span></span><br><span class="line">;; WHEN: 二 <span class="number">8</span>月 <span class="number">16</span> <span class="number">21</span>:<span class="number">20</span>:<span class="number">18</span> CST <span class="number">2022</span></span><br><span class="line">;; MSG SIZE  rcvd: <span class="number">151</span></span><br></pre></td></tr></table></figure>





<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112738.png" alt="image-20220816212308034"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112756.png" alt="image-20220816212543225"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112806.png" alt="image-20220816212701687"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112826.png" alt="image-20220816212928917"></p>
<p><img src="http://img.lindaifeng.vip/typora-picgo-tuchaung/20230506112850.png" alt="image-20220816213120382"></p>

      
    </div>
    <footer class="article-footer">
      
        <div id="donation_div"></div>


<script src="/qingfeng-blog/js/vdonate.js"></script>

<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: 'http://img.lindaifeng.vip/typora-picgo-tuchaung/20230428150832.png',
  alipayImage: 'http://img.lindaifeng.vip/typora-picgo-tuchaung/20230428150823.png'
});
</script>
      
      
      <div>
        <ul class="post-copyright">
          <li class="post-copyright-author">
          <strong>Post author:  </strong>清峰</a>
          </li>
          <li class="post-copyright-link">
          <strong>Post link:  </strong>
          <a href="/qingfeng-blog/2022/11/17/Rancher/Rancher容器云管理平台/" target="_blank" title="Rancher容器云管理平台">http://example.com/2022/11/17/Rancher/Rancher容器云管理平台/</a>
          </li>
          <li class="post-copyright-license">
            <strong>Copyright Notice:   </strong>
            All articles in this blog are licensed under <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">CC BY-NC-ND 4.0</a>
            unless stating additionally.
          </li>
         
        </ul>
<div>

      
      
        
	<div id="comment">
		<!-- 来必力City版安装代码 -->
		<div id="lv-container" data-id="city" data-uid="MTAyMC8yOTQ4MS82MDQ5">
		<script type="text/javascript">
		   (function(d, s) {
		       var j, e = d.getElementsByTagName(s)[0];

		       if (typeof LivereTower === 'function') { return; }

		       j = d.createElement(s);
		       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
		       j.async = true;

		       e.parentNode.insertBefore(j, e);
		   })(document, 'script');
		</script>
		<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
		</div>
		<!-- City版安装代码已完成 -->
	</div>



      
      
        
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/qingfeng-blog/tags/rancher/" rel="tag">rancher</a></li></ul>

      

    </footer>
  </div>
</div>
  
    
<nav id="article-nav">
  
    <a href="/qingfeng-blog/2022/11/21/Docker/Docker%E5%AE%B9%E5%99%A8%E9%97%B4%E7%9B%B8%E4%BA%92%E8%AE%BF%E9%97%AE/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Docker容器间相互访问
        
      </div>
    </a>
  
  
    <a href="/qingfeng-blog/2022/09/26/Mac/M1%20Docker%E5%90%84%E5%BA%94%E7%94%A8%E5%AE%89%E8%A3%85%EF%BC%88%E6%B1%87%E6%80%BB%EF%BC%89/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">M1 Docker各应用安装（汇总）</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="toc-sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
        <ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Rancher%E5%AE%B9%E5%99%A8%E4%BA%91%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0"><span class="nav-number">1.</span> <span class="nav-text">Rancher容器云管理平台</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E4%B8%BB%E6%9C%BA%E7%A1%AC%E4%BB%B6%E8%AF%B4%E6%98%8E"><span class="nav-number">2.</span> <span class="nav-text">一、主机硬件说明</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E4%B8%BB%E6%9C%BA%E9%85%8D%E7%BD%AE"><span class="nav-number">3.</span> <span class="nav-text">二、主机配置</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#2-1-%E4%B8%BB%E6%9C%BA%E5%90%8D"><span class="nav-number">3.1.</span> <span class="nav-text">2.1 主机名</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-2-IP%E5%9C%B0%E5%9D%80"><span class="nav-number">3.2.</span> <span class="nav-text">2.2 IP地址</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-3-%E4%B8%BB%E6%9C%BA%E5%90%8D%E4%B8%8EIP%E5%9C%B0%E5%9D%80%E8%A7%A3%E6%9E%90"><span class="nav-number">3.3.</span> <span class="nav-text">2.3 主机名与IP地址解析</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-4-%E4%B8%BB%E6%9C%BA%E5%AE%89%E5%85%A8%E8%AE%BE%E7%BD%AE"><span class="nav-number">3.4.</span> <span class="nav-text">2.4 主机安全设置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-5-%E4%B8%BB%E6%9C%BA%E6%97%B6%E9%92%9F%E5%90%8C%E6%AD%A5"><span class="nav-number">3.5.</span> <span class="nav-text">2.5 主机时钟同步</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-6-%E5%85%B3%E9%97%ADswap"><span class="nav-number">3.6.</span> <span class="nav-text">2.6 关闭swap</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-7-%E9%85%8D%E7%BD%AE%E5%86%85%E6%A0%B8%E8%B7%AF%E7%94%B1%E8%BD%AC%E5%8F%91"><span class="nav-number">3.7.</span> <span class="nav-text">2.7 配置内核路由转发</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81docker-ce%E5%AE%89%E8%A3%85"><span class="nav-number">4.</span> <span class="nav-text">三、docker-ce安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81rancher%E5%AE%89%E8%A3%85"><span class="nav-number">5.</span> <span class="nav-text">四、rancher安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%94%E3%80%81%E9%80%9A%E8%BF%87Rancher%E9%83%A8%E7%BD%B2kubernetes%E9%9B%86%E7%BE%A4"><span class="nav-number">6.</span> <span class="nav-text">五、通过Rancher部署kubernetes集群</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#5-1-Rancher%E8%AE%BF%E9%97%AE"><span class="nav-number">6.1.</span> <span class="nav-text">5.1 Rancher访问</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-2-%E9%80%9A%E8%BF%87Rancher%E5%88%9B%E5%BB%BAKubernetes%E9%9B%86%E7%BE%A4"><span class="nav-number">6.2.</span> <span class="nav-text">5.2 通过Rancher创建Kubernetes集群</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%85%AD%E3%80%81%E9%85%8D%E7%BD%AE%E9%80%9A%E8%BF%87%E5%91%BD%E4%BB%A4%E8%A1%8C%E8%AE%BF%E9%97%AEKubernetes%E9%9B%86%E7%BE%A4"><span class="nav-number">7.</span> <span class="nav-text">六、配置通过命令行访问Kubernetes集群</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%83%E3%80%81%E9%80%9A%E8%BF%87Rancher%E9%83%A8%E7%BD%B2Nginx%E5%BA%94%E7%94%A8"><span class="nav-number">8.</span> <span class="nav-text">七、通过Rancher部署Nginx应用</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%85%AB%E3%80%81%E9%80%9A%E8%BF%87Rancher%E9%83%A8%E7%BD%B2mysql%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="nav-number">9.</span> <span class="nav-text">八、通过Rancher部署mysql数据库</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#8-1-%E6%8C%81%E4%B9%85%E5%8C%96%E5%AD%98%E5%82%A8%E7%B1%BB%E5%87%86%E5%A4%87"><span class="nav-number">9.1.</span> <span class="nav-text">8.1 持久化存储类准备</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#8-1-1-NFS%E6%9C%8D%E5%8A%A1"><span class="nav-number">9.1.1.</span> <span class="nav-text">8.1.1 NFS服务</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-1-2-%E5%AD%98%E5%82%A8%E5%8D%B7"><span class="nav-number">9.1.2.</span> <span class="nav-text">8.1.2 存储卷</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-2-MySQL%E6%95%B0%E6%8D%AE%E5%BA%93%E9%83%A8%E7%BD%B2"><span class="nav-number">9.2.</span> <span class="nav-text">8.2 MySQL数据库部署</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#8-2-1-PVC%E5%87%86%E5%A4%87"><span class="nav-number">9.2.1.</span> <span class="nav-text">8.2.1 PVC准备</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-2-2-MySQL%E9%83%A8%E7%BD%B2"><span class="nav-number">9.2.2.</span> <span class="nav-text">8.2.2 MySQL部署</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-2-2-MySQL%E8%AE%BF%E9%97%AE"><span class="nav-number">9.2.3.</span> <span class="nav-text">8.2.2 MySQL访问</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#8-2-2-1-%E6%96%B9%E6%A1%88%E4%B8%80-%E9%80%9A%E8%BF%87Rancher-web%E7%95%8C%E9%9D%A2%E8%AE%BF%E9%97%AE"><span class="nav-number">9.2.3.1.</span> <span class="nav-text">8.2.2.1 方案一 通过Rancher web界面访问</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#8-2-2-2-%E6%96%B9%E6%A1%88%E4%BA%8C-%E9%80%9A%E8%BF%87%E4%B8%BB%E6%9C%BA%E8%AE%BF%E9%97%AE"><span class="nav-number">9.2.3.2.</span> <span class="nav-text">8.2.2.2 方案二 通过主机访问</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B9%9D%E3%80%81%E9%83%A8%E7%BD%B2wordpress"><span class="nav-number">10.</span> <span class="nav-text">九、部署wordpress</span></a></li></ol>
    
    </div>
  </aside>


</section>
        
      </div>
      
      <footer id="footer">
  

  <div class="container">
      	<div class="row">
	      <!-- <p> Powered by <a href="http://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/iTimeTraveler/hexo-theme-hiker" target="_blank">Hexo-theme-hiker</a> </p> -->
	      <p>May there be no bug in the world！</p>
        <p id="copyRightEn">Copyright &copy; 2022 - 2023 All Rights Reserved.</p>
	      
	      
    		<p class="busuanzi_uv">
				UV : <span id="busuanzi_value_site_uv"></span> |  
				PV : <span id="busuanzi_value_site_pv"></span>
		    </p>
  		   
		</div>

		
  </div>
</footer>


<!-- min height -->

<script>
    var wrapdiv = document.getElementById("wrap");
    var contentdiv = document.getElementById("content");
    var allheader = document.getElementById("allheader");

    wrapdiv.style.minHeight = document.body.offsetHeight + "px";
    if (allheader != null) {
      contentdiv.style.minHeight = document.body.offsetHeight - allheader.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    } else {
      contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    }
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/qingfeng-blog/" class="mobile-nav-link">首页</a>
  
    <a href="/qingfeng-blog/categories" class="mobile-nav-link">分类</a>
  
    <a href="/qingfeng-blog/tags" class="mobile-nav-link">标签</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  
<link rel="stylesheet" href="/qingfeng-blog/fancybox/jquery.fancybox.css">

  
<script src="/qingfeng-blog/fancybox/jquery.fancybox.pack.js"></script>




<script src="/qingfeng-blog/js/scripts.js"></script>



  
<script src="/qingfeng-blog/js/home.js"></script>




  
<script src="/qingfeng-blog/js/dialog.js"></script>









	<div style="display: none;">
    <script src="https://s95.cnzz.com/z_stat.php?id=1260716016&web_id=1260716016" language="JavaScript"></script>
  </div>



	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h2 class="modal-title" id="myModalLabel">设置</h2>
      </div>
      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">


      <div class="modal-body">
          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" onclick="javascript:setFontSize();" aria-expanded="true" aria-controls="collapseOne">
              正文字号大小
            </a>
          </div>
          <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
          <div class="panel-body">
            您已调整页面字体大小
          </div>
        </div>
      


          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" onclick="javascript:setBackground();" aria-expanded="true" aria-controls="collapseTwo">
              夜间护眼模式
            </a>
        </div>
          <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
          <div class="panel-body">
            夜间模式已经开启，再次单击按钮即可关闭 
          </div>
        </div>

        <div>
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关 于&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
        </div>
         <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
          <div class="panel-body">
            清峰小栈
          </div>
          <div class="panel-body">
            Copyright © 2023 清峰 All Rights Reserved.
          </div>
        </div>
      </div>


      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <div class="modal-footer">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
      </div>
    </div>
  </div>
</div>
  
  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/qingfeng-blog/js/totop.js?v=1.0.0" async=""></script>
  
    <a id="menu-switch"><i class="fa fa-bars fa-lg"></i></a>
  
</body>
</html>